/*
 * Criado em Mar 21, 2005
 *
 *
 */
package vendas.dto;

import gminet.infra.dao.SimpleTransferObject;

import java.util.List;

/**
 * @author Gabriel Flores Mendes
 * 
 * 
 */
public class OrderStatus extends SimpleTransferObject {

    private static final long serialVersionUID = 7596709050028230767L;

    private static final byte UNDEFINED_ID = 0;
    private static final byte ORDERED_ID = 10;
    private static final byte RECEIVED_ID = 20;
    private static final byte SOLD_ID = 30;

    public static final OrderStatus UNDEFINED = new OrderStatus(UNDEFINED_ID, "INDEFINIDO");
    public static final OrderStatus ORDERED = new OrderStatus(ORDERED_ID, "Encomendado");
    public static final OrderStatus RECEIVED = new OrderStatus(RECEIVED_ID, "Recebido");
    public static final OrderStatus SOLD = new OrderStatus(SOLD_ID, "Vendido");

    static {
        Class<OrderStatus> clazz = OrderStatus.class;
        addObject(clazz, ORDERED);
        addObject(clazz, RECEIVED);
        addObject(clazz, SOLD);
    }

    public boolean isOrdered() {

        return getId() == ORDERED_ID;
    }

    public boolean isReceived() {

        return getId() == RECEIVED_ID;
    }

    public boolean isSold() {

        return getId() == SOLD_ID;
    }

    private OrderStatus(int i, String str) {

        super(i, str);
    }

    @SuppressWarnings("unchecked")
    public static List<OrderStatus> getList() {

        return (List<OrderStatus>) getList(OrderStatus.class);
    }

    public static OrderStatus getOrderStatusById(int statusId) {

        return (OrderStatus) getObject(OrderStatus.class, statusId);
    }

}
